package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itheima.model.pojo.Questions;
import com.tanhua.dubbo.mapper.QuestionsMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class QuestionsApiImpl implements QuestionsApi{

    @Autowired
    private QuestionsMapper questionsMapper;

    @Override
    public List<Questions> findByQuestionnaireId(Long id) {
        return questionsMapper.selectList(
                Wrappers.lambdaQuery(Questions.class)
                        .eq(Questions::getQuestionnaireId, id)
        );
    }

    @Override
    public Questions findById(String questionId) {
        return questionsMapper.selectById(questionId);
    }
}
